﻿#ifndef INVENTORYMANAGEMENTVIEW_H
#define INVENTORYMANAGEMENTVIEW_H
#include"XQWidget.h"
#include"InventoryModel.h"
class InventoryView;
//库存
class InventoryManagementView :public XQWidget
{
	Q_OBJECT
public:
	InventoryManagementView(QWidget* parent = nullptr);
	~InventoryManagementView();
	enum CreateWidget;
public:
	XQTablePagingWidget* tableView()const;
	InventoryModel inventory(qint64 index);
	void setInventory(qint64 index, const InventoryModel& model);
	void setInventory(const QList<InventoryModel>& list);
	void addInventory(const InventoryModel& inventory);
	void removeInventory(const InventoryModel& inventory);
	void clear();
	void showInventory(int page = 1);
	void updataTable();
public:
	//获取类型列表
	QStringList typeList();
signals://信号
	void addInventorySignals(const InventoryModel& inventory);
	void addInventoryCreateSignals(InventoryView* view);
	void modifyInventorySignals(const InventoryModel& inventory);
	void removeInventorySignals(const InventoryModel& inventory);

public:
	//初始化
	virtual void init();
protected://
	void addOperate();
	void modifyOperate();
	void removeOperate();
protected://初始化
	virtual void init_ui();
	void init_table();
	QWidget* init_operateButton();//操作按钮
protected:
	QSet<QString>m_type;//
	XQTablePagingWidget* m_tableView = nullptr;
	QPushButton* m_addButton = nullptr;
	QPushButton* m_modifyButton = nullptr;
	QPushButton* m_removeButton = nullptr;
};
enum InventoryManagementView::CreateWidget
{
	InventoryAddView,
	InventoryModifyView,
	//InventoryRemoveView,
};
#endif